<template lang="html">
	<div id="app2">
	    	<div class="top" style="font-size: .5rem;margin-left:5%;padding-top: .2rem;color: gray;" @click="gotoBack()">x</div>
		<div class="appp" style="font-family: '幼圆';">
			<img src="../../static/img/smiling.png" />欢迎来到寺库
		</div>
		<div id="app2_app2">
		 <div id="app2_a" style="background-color: white;">
		 	<input style="background-color: white;" type="text" placeholder="手机号/邮箱" v-model="users" name="" id="" value="" /></div>
		 <div id="app2_b">
		 	<input  type="password" placeholder="密码" v-model="passer" name="" id="" value="" /></div>
		 </div>
		 <div id="" @click="addCar(passer)">
		 <div id="button">
		 	<button v-if="flag" id="button_a" @click="addCart(users)" value="1">注册</button>
		 	<button v-else id="button_a" @click="addCart(users)"
		 		 style="font-size: .2rem;color:red;" value="1">注册成功,正在跳转登录..</button>
		   <button id="button_b" @click="enter">去登录</button>
		 </div>
		 <div id="test" style="color: red; "></div>
		 </div>
	</div>

</template>

<script>
import Bus from '../route/bus';
export default {
	data(){
		return{
			users:'',
			passer:'',
			flag:true
		}
	},
	methods:{
		enter(){
			history.go(-1)
			console.log('我是跳转我被点了')
			this.$emit('listen','shows')
		},
	gotoBack(){
			history.back()
		},
	addCart(shows) {

 var a=document.getElementById("test");
 console.log(this.users.length)
if (this.users.length>0){
   Bus.$emit('getTarget', shows);
 }

  },
  addCar(){
  	var a=document.getElementById("test");
  	var input1=document.getElementById('button_a')
  	var input2=document.getElementById('button_b')
//	this.flag=false;
  	if (this.passer.length>0){
  		var showss=this.passer
   Bus.$emit('getTar', showss);
   if(this.users.length>0){
// 	 a.innerHTML='注册成功,正在跳转登录..';
// 	 a.classList.add('test1');
   this.flag=false
   location.replace('/my#/my')
   }else{
   	a.innerHTML='注册失败,用户名不能为空'
   	setTimeout(()=>{a.innerHTML=''},1000)
   	this.users=' '
   	a.classList.add('test1');
   	history.go(0)
   }
   setCookie('bol',true,'2')

 }else{
 	if(this.users>0){
 	 a.classList.add('test2');
 	 a.innerHTML='注册失败,密码不能为空';
 	 	setTimeout(()=>{a.innerHTML=''},1000)
        this.passer=' '
 	 	setTimeout(function(){
   	 		history.go(0)
 	a.style.display="none";},1000);
 	}else{
 		a.innerHTML='注册失败,密码和用户名不能为空';
 		setTimeout(()=>{a.innerHTML=''},1000)
 		this.users=' '
 		a.classList.add('test1');
 		console.log(input1)
 	 	setTimeout(function(){
   		history.go(0)
 	 a.style.display="none";},1000);
 	}
 }
	}
	},
	mounted(){
		console.log(this.passers)
		this.users=''
	if(this.aa==true){
		this.$emit('listen','false')
	}
	},
	watch:{
		'this.shows'(news,olds){
			console.log('11')
			console.log(news)
		}
	}

	}

</script>
<style lang="css" scoped>
<<<<<<< HEAD
	#test{
		position:fixed ;
		font-size: .25rem;
	}
=======
<<<<<<< HEAD
	#test{
			position:fixed ;
			font-size: .25rem;

		}
=======
#test{
		position:fixed ;
		font-size: .25rem;
		
	}
>>>>>>> 6edb15c69c7de41ed3187b8454ecd7012cec4f8b
>>>>>>> 25352579ee102b93b05c24ddf72aa18a9d2db6bc
	.test1{
		top:2.9rem;
		left: 1.6rem;
	}
	.test2{
		top:3.7rem;
		left: 1.7rem;
	}
	#app2{
		background: white;
		height: 10.5rem;
	}
	.appp>img{
		vertical-align: middle;
		padding-right: 5%;
	}
	#app2 .appp{
		width: 100%;
		height: 2rem;
		text-align: center;
		line-height: 2rem;
		color: black;
		font-family: "微软雅黑";
		font-size:.4rem;
		background: white;
	}
	#app2_app2{
		overflow: hidden;
		width: 100%;
		background: white;
		/*margin-top:2rem;*/
	}
	#button_a{
		width: 81%;
		text-align: center;
		margin-left: 10%;
		border: 1px solid gray;
		background: blue;
		color: white;
		font-size: .35rem;
		margin-top:.5rem;
	}
	#button_b{
		border: none;
		color: blue;
		margin-left: 40%;
		font-size: .25rem;
		margin-top:.3rem;
	}
	#app2_a,#app2_b{
		width:80%;
		margin: 0 auto;
		margin-top: .2rem;
		border-bottom: 1px solid blue;
	}
    #app2 input{
    	border: none;
    	width: 100%;
    	text-align: center;
    	margin:0 auto;
    }
</style>
